<?php 
global $_W,$_GPC;
include MODULE_ROOT.'/inc/mobile/__init.php';

$title = "佣金明细";

$tid = intval($_GPC['tid']);
$sql = "SELECT * FROM ".tablename('imeepos_runner3_moneylog')." WHERE id = :id";
$params = array(':id'=>$tid);
$moneylog = pdo_fetch($sql,$params);


$moneylog['create_time'] = date('Y-m-d h:i',$moneylog['create_time']);

$sql = "SELECT * FROM ".tablename('imeepos_runner3_recive')." WHERE id = :id";
$params = array(':id'=>$moneylog['reciveid']);
$recive = pdo_fetch($sql,$params);


$sql = "SELECT * FROM ".tablename('imeepos_runner3_member')." WHERE uniacid = :uniacid AND openid = :openid";
$params = array(':uniacid'=>$_W['uniacid'],':openid'=>$recive['openid']);
$runner = pdo_fetch($sql,$params);

$recive['nickname'] = $runner['nickname'];
$recive['avatar'] = $runner['avatar'];
$recive['create_time'] = date('Y-m-d h:i',$recive['create_time']);

$sql = "SELECT * FROm ".tablename('imeepos_runner3_tasks')." WHERE id = :id";
$params = array(':id'=>$recive['taskid']);
$task = pdo_fetch($sql,$params);

$task['update_time'] = date('Y-m-d h:i',$task['update_time']);


$sql = "SELECT * FROM ".tablename('imeepos_runner3_member')." WHERE uniacid = :uniacid AND openid = :openid";
$params = array(':uniacid'=>$_W['uniacid'],':openid'=>$task['openid']);
$member = pdo_fetch($sql,$params);

$task['nickname'] = $member['nickname'];
$task['avatar'] = $member['avatar'];

$_pjax = trim($_GPC['_pjax']);

$template_content = $template.'/runner/money_detail';

if($_W['isajax']){
	include $this->template($template_content,TEMPLATE_FETCH);
}else{
	include $this->template($template.'/index');
}